package re_0905.question_meituan;

import java.util.concurrent.TimeUnit;

/**
 * 生产者接口，用户类
 */
class User implements Runnable{

    public static User getInstance(){
        return new User();
    }

    private User(){
        System.out.println("有用户下单了");
    };

    @Override
    public void run() {
        try {
            long timeout = (long) (Math.random() * 10);//随机指定订单的时间
            System.out.println("预计送达时间"+timeout+"s以后");
            TimeUnit.SECONDS.sleep(timeout);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
